Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@turf/rhumb-bearing
Advanced tools
@turf/rhumb-bearing is a module from the Turf.js library that calculates the bearing between two geographical points along a rhumb line (a line of constant bearing). This is useful for navigation and mapping applications where you need to determine the direction from one point to another.
Calculate Rhumb Bearing
This feature calculates the rhumb bearing between two geographical points. The code sample demonstrates how to use the `rhumbBearing` function to find the bearing from point1 to point2.
const turf = require('@turf/turf');
const point1 = turf.point([0, 0]);
const point2 = turf.point([10, 10]);
const bearing = turf.rhumbBearing(point1, point2);
console.log(bearing);
Geolib is a library for geospatial calculations. It provides a variety of functions for distance, bearing, and other geographical calculations. Unlike @turf/rhumb-bearing, Geolib offers a broader range of geospatial utilities but may not be as specialized in rhumb line calculations.
Geodesy is a library for geodesic and rhumb line calculations. It offers detailed and precise methods for calculating distances, bearings, and other geospatial metrics. Compared to @turf/rhumb-bearing, Geodesy provides more comprehensive geodesic calculations but may be more complex to use.
Takes two points and finds the bearing angle between them along a Rhumb line i.e. the angle measured in degrees start the north line (0 degrees)
start
Coord starting Point
end
Coord ending Point
options
Object? Optional parameters (optional, default {}
)
options.final
boolean calculates the final bearing if true (optional, default false
)var point1 = turf.point([-75.343, 39.984], {"marker-color": "#F00"});
var point2 = turf.point([-75.534, 39.123], {"marker-color": "#00F"});
var bearing = turf.rhumbBearing(point1, point2);
//addToMap
var addToMap = [point1, point2];
point1.properties.bearing = bearing;
point2.properties.bearing = bearing;
Returns number bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/rhumb-bearing
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf rhumb-bearing module
The npm package @turf/rhumb-bearing receives a total of 622,536 weekly downloads. As such, @turf/rhumb-bearing popularity was classified as popular.
We found that @turf/rhumb-bearing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.